<template>
	<view class="fast-select-radio">
		<view 
			class="fast-select-item" 
			:class="value[0] == index ? 'selected' : ''"
			v-for="(item, index) in data" 
			@click.stop="onChange(item, index)"
		>
			{{ label ? item[label] : item }}
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			value: {
				type: Array,
				default: () => {
					return []
				}
			},
			label: {
				type: String,
				default: ''
			},
			//下拉框数据源
			data: {
				type: Array,
				default: () => {
					return []
				}
			}
		},
		onShow() {
			console.log(this.value)
		},
		data() {
			return {
			}
		},
		methods: {
			onChange(item, index){
				this.$set(this.value, 0, index)
				this.$emit('input', this.value)
				this.$emit('change', item, index)
			}
			
		}
	}
</script>

<style lang="less" scoped>
	.fast-select-radio{
		.fast-select-item{
			text-align: center;
		}
		
		.selected{
			color: #007AFF;
		}
	}

</style>
